package com.chatplus.application.processor.channel.chat.xunfei.dto;

import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.List;

/**
 * 讯飞请求
 *
 * @author chj
 * @date 2024/1/5
 **/
public class XunFeiRequestDTO {
    @JsonProperty("header")
    private HeaderDTO header;
    @JsonProperty("parameter")
    private ParameterDTO parameter;
    @JsonProperty("payload")
    private PayloadDTO payload;

    public HeaderDTO getHeader() {
        return header;
    }

    public void setHeader(HeaderDTO header) {
        this.header = header;
    }

    public ParameterDTO getParameter() {
        return parameter;
    }

    public void setParameter(ParameterDTO parameter) {
        this.parameter = parameter;
    }

    public PayloadDTO getPayload() {
        return payload;
    }

    public void setPayload(PayloadDTO payload) {
        this.payload = payload;
    }

    public static class HeaderDTO {
        /**
         * 应用appid，从开放平台控制台创建的应用中获取
         */
        @JsonProperty("app_id")
        private String appId;
        /**
         * 应用appid，从开放平台控制台创建的应用中获取
         */
        @JsonProperty("uid")
        private String uid;

        public HeaderDTO() {
        }
        public HeaderDTO(String appId, String uid) {
            this.appId = appId;
            this.uid = uid;
        }
        public String getAppId() {
            return appId;
        }

        public void setAppId(String appId) {
            this.appId = appId;
        }

        public String getUid() {
            return uid;
        }

        public void setUid(String uid) {
            this.uid = uid;
        }
    }

    public static class ParameterDTO {
        private ChatDTO chat;

        public ParameterDTO() {
        }
        public ParameterDTO(ChatDTO chat) {
            this.chat = chat;
        }
        public ChatDTO getChat() {
            return chat;
        }

        public void setChat(ChatDTO chat) {
            this.chat = chat;
        }

        public static class ChatDTO {
            /**
             * 指定访问的领域,general指向V1.5版本 generalv2指向V2版本。注意：不同的取值对应的url也不一样！
             */
            @JsonProperty("domain")
            private String domain;
            /**
             * 核采样阈值。用于决定结果随机性，取值越高随机性越强即相同的问题得到的不同答案的可能性越高
             */
            @JsonProperty("temperature")
            private Float temperature;
            /**
             * 模型回答的tokens的最大长度
             */
            @JsonProperty("max_tokens")
            private Integer maxTokens;

            public ChatDTO() {
            }
            public ChatDTO(String domain, Float temperature, Integer maxTokens) {
                this.domain = domain;
                this.temperature = temperature;
                this.maxTokens = maxTokens;
            }
            public String getDomain() {
                return domain;
            }

            public void setDomain(String domain) {
                this.domain = domain;
            }

            public Float getTemperature() {
                return temperature;
            }

            public void setTemperature(Float temperature) {
                this.temperature = temperature;
            }

            public Integer getMaxTokens() {
                return maxTokens;
            }

            public void setMaxTokens(Integer maxTokens) {
                this.maxTokens = maxTokens;
            }
        }
    }

    public static class PayloadDTO {
        @JsonProperty("message")
        private MessageDTO message;

        public PayloadDTO() {
        }
        public PayloadDTO(MessageDTO message) {
            this.message = message;
        }
        public static class MessageDTO {
            public MessageDTO() {
            }
            public MessageDTO(List<XunFeiMsgDTO> text) {
                this.text = text;
            }
            @JsonProperty("text")
            private List<XunFeiMsgDTO> text;

            public List<XunFeiMsgDTO> getText() {
                return text;
            }

            public void setText(List<XunFeiMsgDTO> text) {
                this.text = text;
            }
        }

        public MessageDTO getMessage() {
            return message;
        }

        public void setMessage(MessageDTO message) {
            this.message = message;
        }
    }
}
